package com.sky.mapper;

import com.sky.annotations.AutoFill;
import com.sky.dto.SetmealPageDTO;
import com.sky.entity.SetmealEntity;
import com.sky.enumeration.OperationType;
import com.sky.enumeration.SetmealStatusEnum;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {
    @Select("select count(id) from setmeal where category_id = #{id}")
    Integer countByCategoryId(Long id);

    void update(SetmealEntity entity);


    List<SetmealEntity> list(SetmealEntity setmealEntity);

    @AutoFill(OperationType.INSERT)
    void save(SetmealEntity setmealEntity);

    List<SetmealEntity> page(@Param("pageDto") SetmealPageDTO pageDTO, @Param("status") SetmealStatusEnum statusEnum);

    SetmealVO getByIdWithDish(@Param("id") Long id);

    SetmealEntity getById(Long id);

    void deleteBatch(@Param("ids") List<Long> ids);

    Integer countBySetmealEnable(@Param("ids") List<Long> ids);
}

